home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
TextObjects.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
7KB
|
198 lines
/*
File: TextObjects.h
Contains: Text object Interfaces.
Version: Technology: System 8
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __TEXTOBJECTS__
#define __TEXTOBJECTS__
#ifndef __CONDITIONALMACROS__
#include <ConditionalMacros.h>
#endif
#ifndef __TYPES__
#include <Types.h>
#endif
#ifndef __UNICODE__
#include <Unicode.h>
#endif
#ifndef __TEXTCOMMON__
#include <TextCommon.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
/* Basic data types */
typedef UInt32 TextObjectUnit;
typedef TextObjectUnit *TextObject;
typedef TextObject *TextObjectPtr;
typedef const TextObjectUnit *ConstTextObject;
/* Indices into text objects */
typedef UInt32 TextObjectIndex;
enum {
kTextObjectStart = 0L,
kTextObjectEnd = 0xFFFFFFFF
};
/* Option flags */
typedef OptionBits TextObjectOptions;
/*
The default or standard OptionBits are all zero by convention. The following
symbolic constant is provided for code readability.
*/
enum {
kTextObjStandardOptions = 0
};
enum {
kTextObjNormalizeOptBit = 0
};
enum {
kTextObjDontNormalizeOpt = 0 << kTextObjNormalizeOptBit,
kTextObjNormalizeOpt = 1 << kTextObjNormalizeOptBit
};
/* Creation and destruction */
extern OSStatus NewTextObject(TextObject *newTextObject);
extern OSStatus InitPersistentTextObject(TextObjectUnit textObjectSpace[], ByteCount sizeInBytes);
extern OSStatus DisposeTextObject(TextObject textObject);
extern OSStatus CreateTextObjectFromTextObject(ConstTextObject oldTextObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObject *newTextObject, TextObjectOptions optionBits);
/* Text content manipulation */
extern OSStatus InstallTextIntoTextObject(const char *srcText, ByteCount srcLengthInBytes, TextEncoding srcEncoding, LocaleIdentifier language, TextObject destTextObject, TextObjectOptions optionBits);
extern OSStatus AppendTextToTextObject(const char *srcText, ByteCount srcLengthInBytes, TextEncoding srcEncoding, LocaleIdentifier language, TextObject destTextObject, TextObjectOptions optionBits);
extern OSStatus ExtractTextFromTextObject(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, char *destText, ByteCount destMaxSizeInBytes, TextEncoding destEncoding, LocaleIdentifier *language, ByteCount *destSizeInBytes, TextObjectIndex *nextSrcIndex);
extern OSStatus ReplaceInTextObject(TextObject destText, TextObjectIndex destStartIndex, TextObjectIndex destEndIndex, ConstTextObject srcText, TextObjectIndex srcStartIndex, TextObjectIndex srcEndIndex, TextObjectIndex *newStartIndex, TextObjectIndex *newEndIndex);
/* Text object information */
extern Boolean IsPersistentTextObject(ConstTextObject textObject);
extern Boolean IsTextObjectEmpty(ConstTextObject textObject);
extern ByteCount GetTextObjectSize(ConstTextObject textObject);
extern ByteCount GetTextObjectMaxSize(ConstTextObject textObject);
extern TextObjectIndex GetTextObjectEndIndex(ConstTextObject textObject);
extern ByteCount ComputePersistentTextObjectSize(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectOptions optionBits);
extern ByteCount ComputePersistentTextObjectFromTextSize(const char *text, ByteCount textByteLength, TextEncoding textEncoding, LocaleIdentifier language, TextObjectOptions optionBits);
extern OSStatus ComputeTextObjectExtractedTextSize(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ByteCount destMaxSizeInBytes, TextEncoding destEncoding, LocaleIdentifier *language, ByteCount *destResultLengthInBytes, TextObjectIndex *nextSrcIndex);
extern OSStatus GetTextObjectTextTags(ConstTextObject textObject, TextObjectIndex index, TextEncoding *encoding, LocaleIdentifier *language);
/* This is equivalent to the preceding function. The preceding name is preferred. */
extern OSStatus GetTextObjectEncodingAndLocaleIdentifier(ConstTextObject textObject, TextObjectIndex index, TextEncoding *encoding, LocaleIdentifier *language);
/* Bulk access to text content */
struct TextObjectTextInfo {
TextEncoding encoding;
LocaleIdentifier language;
TextObjectIndex startIndex;
TextObjectIndex endIndex;
ByteCount textLength;
const char * text;
};
typedef struct TextObjectTextInfo TextObjectTextInfo;
extern OSStatus CountTextObjectTextRuns(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ItemCount *numTextRuns);
extern OSStatus GetTextObjectTextRuns(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, ItemCount runArraySize, TextObjectTextInfo runInfo[], ItemCount *actualNumTextRuns);
/* Comparison functions are in TextUtils */
/* Annotations */
/* Annotation types are given by the traditional four-character codes */
typedef FourCharCode TextObjectAnnotationTag;
/* A wildcard tag to specify all annotations */
enum {
kTextObjAnyAnnotationType = '****'
};
/* Annotation attributes */
typedef OptionBits TextObjectAnnotationAttributes;
/* Annotation attribute bits */
enum {
kTextObjAnnotationChangedMask = 0x01,
kTextObjTextChangedMask = 0x02
};
extern OSStatus AnnotateTextObject(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ByteCount dataLength, const void *data, TextObjectAnnotationAttributes annotationOptions);
extern OSStatus DeleteTextObjectAnnotations(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType);
/* Accessing annotations */
struct TextObjectAnnotationInfo {
TextObjectAnnotationTag annotationType;
TextObjectIndex rangeStart;
TextObjectIndex rangeEnd;
TextObjectAnnotationAttributes attributes;
ByteCount dataSize;
const void * data;
};
typedef struct TextObjectAnnotationInfo TextObjectAnnotationInfo;
extern OSStatus CountTextObjectAnnotations(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ItemCount *numAnnotations);
extern OSStatus GetTextObjectAnnotations(ConstTextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, ItemCount infoArraySize, TextObjectAnnotationInfo annotationInfo[], ItemCount *actualNumAnnotations);
extern OSStatus SetAnnotationAttributes(TextObject textObject, TextObjectIndex startIndex, TextObjectIndex endIndex, TextObjectAnnotationTag annotationType, TextObjectAnnotationAttributes annotationOptions);
/* Miscellaneous */
extern OSStatus VerifyTextObject(ConstTextObject textObject);
extern OSStatus NormalizeTextObject(TextObject textObject);
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __TEXTOBJECTS__ */